import java.util.Scanner;
import java.util.Stack;

/*
    有效的括号
 */
public class ValidParentheses {
    public static void main(String[] args) {
        Stack<Character> stack = new Stack<>();
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        for (int i = 0 ; i < s.length() ; i++){
            char c = s.charAt(i);
            if (c == '(' || c == '[' || c == '{'){
                stack.push(c);
            } else {
                if(stack.isEmpty()){
                    System.out.println("flase");
                    break;
                }
                char a = stack.pop();
                if (c == ')' && a != '('){
                    System.out.println("flase");
                    break;
                }
                if (c == '}' && a != '{'){
                    System.out.println("flase");
                    break;
                }
                if (c == ']' && a != '['){
                    System.out.println("flase");
                    break;
                }
            }
        }
        System.out.println(stack.isEmpty());
    }
}
